package com.lagou.edu.lagouserviceemail.controller;

import com.lagou.edu.EmailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 发送邮件控制器
 *
 * @author: qinmp
 * @date:2020-09-20 11:48
 * @copyright:
 */
@RestController
@RequestMapping("/email/")
public class EmailController {

    Logger logger = LoggerFactory.getLogger(EmailController.class);

    @Autowired
    private EmailService emailService;

    @PostMapping("/send")
    public boolean sendEmail(@RequestParam String email,
                             @RequestParam String code){
        logger.info("sendEmail interface invoke email:[{}], code:[{}]", email, code);
        return emailService.sendRandomCodeEMail(email, code);
    }

}
